home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tspa2555.zip / TSUNTF.TST < prev    next >
Text File  |  1990-06-14  |  2KB  |  76 lines

  1. (* This is a test program for the TSUNTF.TPU unit
  2.    All rights reserved 19-Aug-89
  3.    Updated 23-Sep-89, 21-Mar-90
  4. *)
  5.  
  6. uses Dos,
  7.      Crt,
  8.      TSUNTF;
  9.  
  10. procedure LOGO;
  11. begin
  12.   writeln;
  13.   writeln ('TSUNTF unit test by Prof. Timo Salmi, 21-Mar-90');
  14.   writeln ('University of Vaasa, Finland, ts@chyde.uwasa.fi');
  15.   writeln;
  16.   writeln ('....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....');
  17. end;  (* logo *)
  18.  
  19. (* Input line-editing *)
  20. procedure TEST1;
  21. var sj     : string;
  22.     prompt : string;
  23.     tmp    : string;
  24. begin
  25.   prompt := 'Give your input> ';
  26.   FillChar (tmp, SizeOf(tmp), '.');  { If you are wondering about these two, }
  27.   tmp[0] := chr(Length(prompt));     { they just produce points to show where}
  28.   repeat                             { we are.                               }
  29.     EDRDLN (prompt, sj);
  30.     writeln (tmp, sj);
  31.   until sj = 'exit';
  32. end;  (* test1 *)
  33.  
  34. (* Iput line-editing with recall potential *)
  35. procedure TEST2;
  36. var sj     : string;
  37.     old    : string;
  38.     prompt : string;
  39.     tmp    : string;
  40. begin
  41.   prompt := 'Give your input> ';
  42.   old := '';
  43.   repeat
  44.     EDREADLN (prompt, old, sj);
  45.     writeln (sj);
  46.     old := sj;
  47.   until sj = 'exit';
  48. end;  (* test2 *)
  49.  
  50. (* Iput line-editing with recall and break potential *)
  51. procedure TEST3;
  52. var sj     : string;
  53.     old    : string;
  54.     prompt : string;
  55.     tmp    : string;
  56.     BreakPressed : boolean;
  57. begin
  58.   prompt := 'Give your input> ';
  59.   old := '';
  60.   repeat
  61.     EDREABLN (prompt, old, 79, sj, BreakPressed);
  62.     writeln (sj);
  63.     old := sj;
  64.   until BreakPressed;   {Press ctrl-c or break}
  65.   writeln ('Break was pressed');
  66. end;  (* test3 *)
  67.  
  68. (* Main program *)
  69. begin
  70.   ClrScr;
  71.   LOGO;
  72.   { TEST1; }
  73.   { TEST2; }
  74.   TEST3;
  75. end.  (* tsuntf.tst *)
  76.